<!DOCTYPE html>
<html lang="en">
<!-- 鼠标事件 -->
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        const div = document.querySelector('div')
        div.addEventListener('mouseenter', function () {
            console.log('鼠标经过了')
        })
        div.addEventListener('mouseleave', function () {
            console.log('鼠标离开了');

        })
    </script>
</body>

</html>